﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GMS.Utils;

public partial class Public_MFHead : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["_User"] == null)
        {
            Response.Write("<script language='javascript'>top.location.href='" + Request.ApplicationPath + @"/login.aspx';</script>");
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        if (Session["_User"] == null)
        {
            Response.Write("<script language='javascript'>top.location.href='" + Request.ApplicationPath + @"/login.aspx';</script>");
            return;
        }
        GMS.Model.User user = (GMS.Model.User)Session["_User"];
        System.Text.StringBuilder logInfo = new System.Text.StringBuilder();
        logInfo.Append("您好，");
        logInfo.Append(Session["_UserName"]);
        logInfo.Append("！&nbsp;&nbsp;");
        logInfo.Append("今天是：" + System.DateTime.Now.ToString("D") + "&nbsp;&nbsp;");//中文年月日

        //星期：         
        logInfo.Append(ConstantHelper.C_WeekDayName[Convert.ToInt16(DateTime.Now.DayOfWeek)]); 
        //下面这些信息属于登录信息，现在放到帐户信息里面了
        //logInfo.Append("IP：");
        //logInfo.Append(Request.UserHostAddress.ToString());
        //logInfo.Append("&nbsp&nbsp;&nbsp;&nbsp;");
        //logInfo.Append("访问次数：");
        //logInfo.Append((user.VisitTimes + 1).ToString());
        //logInfo.Append("&nbsp&nbsp;&nbsp;&nbsp;");
        //logInfo.Append("登陆时间：");
        //logInfo.Append(DateTime.Now.ToString());      
        PLogInfo.InnerHtml = logInfo.ToString();
        //系统标题
        SPNSysTitle.InnerText = SysSettings.GetHeadTitle();
    }
    /// <summary>
    /// 退出系统
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Quit_Click(object sender, EventArgs e)
    {
        if (Session["UserID"] != null)
        {
        //    GMS.BLL.LogInfoBLL.Add(HttpContext.Current.Session["UserID"].ToString(), (int)GMS.Utils.EnumHelper.E_LogInfoType.LOGOUT,
        //             HttpContext.Current.Request.UserHostAddress.ToString(), GMS.Utils.ConstantHelper.C_LOGINFO_LOGOUT, "", "TAB_USER");
            Session.Clear();
        }
        //Dvbbs.Utils.Cookie.Remove("user");
        Response.Write("<script language='javascript'>top.location.href='" + Request.ApplicationPath + @"/login.aspx';</script>");
    }
}
